<include file="public@header"/>
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li ><a href="{:url('Advert/index')}">广告列表</a></li>
			<li class="active"><a >编辑</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form" action="{:url('Advert/editPost')}">
		   <input type="hidden" name="id" value="{$video['id']}">
		   <input type="hidden" name="nopass_time" value="{$video['nopass_time']}">
			<fieldset>
			
			
				<div class="form-group" >
					<label for="input-user_nickname" class="col-sm-2 control-label"><span class="form-required">*</span>用户信息</label>
					<div class="col-md-6 col-sm-10">
						<input type="text" class="form-control" id="input-user_nickname"  value=" {$video['userinfo']['user_nickname']} ({$video['uid']}) " readonly />
					</div>
				</div>
				
				<div class="form-group" >
					<label for="input-title" class="col-sm-2 control-label"><span class="form-required">*</span>标题</label>
					<div class="col-md-6 col-sm-10">
						<input type="text" class="form-control" id="input-title"  name="title" value="{$video['title']}" />
					</div>
				</div>
				
				
				
				
				<div class="form-group">
					<label for="input-user_login" class="col-sm-2 control-label"><span class="form-required">*</span>图片</label>
					<div class="col-md-6 col-sm-10">
						<input type="hidden" name="thumb" id="thumbewm" value="{$video['thumb']}">
						<a href="javascript:uploadOneImage('图片上传','#thumbewm');">
							<if condition="$video['thumb'] neq ''">
								<img src="{:get_upload_path($video['thumb'])}"
											 id="thumbewm-preview"
											 style="cursor: pointer;max-width:150px;max-height:150px;"/>
							<else/>
								<img src="__TMPL__/public/assets/images/default-thumbnail.png" id="thumbewm-preview" style="cursor: pointer;max-width:150px;max-height:150px;"/>
							</if>
							
						</a>
						<input type="button" class="btn btn-sm btn-cancel-thumbewm" value="取消图片">
					</div>
				</div>
				
				
				<div class="form-group" >
					<label for="input-ad_endtime" class="col-sm-2 control-label">到期时间</label>
					<div class="col-md-6 col-sm-10">
						<input type="text" class="js-bootstrap-date form-control" id="input-ad_endtime"  name="ad_endtime" autocomplete="off" value="{$video['ad_endtime']}" />
					</div>
				</div>
				
				
				<div class="form-group" >
					<label for="input-ad_endtime" class="col-sm-2 control-label">视频</label>
					<div class="col-md-6 col-sm-10">
						<!-- <input type="hidden" name="href" id="thumb3" value="{$video['href']}"> -->
						<div class="playerzmblbkjP" id="playerzmblbkjP" style="width:500px;height:500px;"></div>
					</div>
				</div>
				

				<div class="form-group">
					<label for="input-video_upload_type" class="col-sm-2 control-label"><span class="form-required">*</span>视频上传型式</label>
					<div class="col-md-6 col-sm-10">
				
						
						<label class="radio-inline"><input type="radio" name="video_upload_type" value="0" >视频链接</label>
						<label class="radio-inline"><input type="radio" name="video_upload_type" value="1" >视频文件</label>

						
						<span class="form-required" >* 需要更改视频时请选择对应上传型式,不需要重新上传视频时无需选择</span>
					</div>
				</div>

				<div class="form-group video_url_area" style="display: none;" >
					<label for="input-href_e" class="col-sm-2 control-label"><span class="form-required">*</span>视频链接</label>
					<div class="col-md-6 col-sm-10">
						<input type="text" class="form-control" id="input-href_e"  name="href_e"  />
						<p class="help-block">以http://或https://开头，文件名不要使用中文,使用英文和数字命名即可</p>
					</div>
				</div>

				<div class="form-group upload_video_area" style="display: none;">
					<label for="input-file" class="col-sm-2 control-label">上传视频</label>
					<div class="col-md-6 col-sm-10">
						<input type="file" class="form-control" id="input-file"  name="file"  />
					</div>
				</div>
				
				<div class="form-group" >
					<label for="input-ad_url" class="col-sm-2 control-label"><span class="form-required">*</span>广告外链</label>
					<div class="col-md-6 col-sm-10">
						<input type="text" class="form-control" id="input-ad_url"  name="ad_url" value="{$video['ad_url']}" />
					</div>
				</div>

			</fieldset>

			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('EDIT')}</button>
					<if condition="$from eq 'index'">
						<a class="btn btn-default" href="{:url('Advert/index')}">{:lang('BACK')}</a>
					<elseif condition="$from eq 'lower'" />
						<a class="btn btn-default" href="{:url('Advert/lowervideo')}">{:lang('BACK')}</a>
						
					</if>
				</div>
				
			</div>


			<input type="hidden" name="thumb_old" value="{$video['thumb']}">
		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
	<script type="text/javascript" src="__STATIC__/playback/ckplayer.js" charset="utf-8"></script>
	<script src="__STATIC__/xigua/xgplayer.js?t=1574906138" type="text/javascript"></script>
    <script src="__STATIC__/xigua/backups/xgplayer-flv.js.js" type="text/javascript"></script>
    <script src="__STATIC__/xigua/backups/xgplayer-hls.js.js" type="text/javascript"></script>
    <script src="__STATIC__/xigua/player.js?t=1581042252" type="text/javascript"></script>
    <script>
    (function(){
        var pull='{$video['href']}';
        if(pull){
            xgPlay('playerzmblbkjP',pull);
        }
    })()
    </script>


<script type="text/javascript">
		$(function(){

			$("input[name='video_upload_type']").click(function(){
				var val=$("input[name='video_upload_type']:checked").val();
				console.log(val);
				if(val==0){
					$(".video_url_area").show();
					$(".upload_video_area").hide();
				}else{
					$(".video_url_area").hide();
					$(".upload_video_area").show();
					$("input[name='href']").val('');
				}
			});
			
			
			$('.btn-cancel-thumbewm').click(function () {
				$('#thumbewm-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
				$('#thumbewm').val('');
			});

			

		});
	</script>
</body>
</html>